/**
 * Created by limeng on 16/4/29.
 */
var MyDraftCtrl = delegateApp.controller('MyDraftCtrl', function ($scope, $rootScope, $http) {
    $scope.searchMap.proposalState = 0;
    $scope.searchMap.authorId = $rootScope.delegate.id;

    $scope.deleteProposal = function (proposal) {
        var proposalId = proposal.id;
        bootbox.confirm("真的要删除这个提案吗?", function (res) {
            if (res) {
                $http.delete("/proposal/"+proposalId).success(function (data) {
                    if (data.state) {
                        bootbox.alert("删除成功!");
                        $scope.updateContent();
                    }
                }).error(function() {
                    bootbox.alert("服务器没有响应!");
                });
            }
        });
    };
});